#!/bin/sh

ENDPORT=$((START_PORT+NODE_NUM))
PORT=${START_PORT}
#REPLICAS=1
HOSTS=""
find /usr/local/etc/redis/ -name "redis-*.conf" | xargs rm -rf
while [ $((PORT < ENDPORT)) != "0" ]; do
    # 初始化,生成配置文件
    cp /usr/local/etc/redis/redis-port.conf.tmpl /usr/local/etc/redis/redis-${PORT}.conf
    sed -i "s/PORT/${PORT}/g" /usr/local/etc/redis/redis-${PORT}.conf

    cat /usr/local/etc/redis/redis-${PORT}.conf
    PORT=$((PORT+1))
done
ls -la /usr/local/etc/redis
#redis-cli --cluster create $HOSTS --cluster-replicas $REPLICAS
#exit 0
